<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>闪烁点</title>

    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.css">
    <link rel="stylesheet" href="https://rawgit.com/mapshakers/leaflet-icon-pulse/master/src/L.Icon.Pulse.css"/>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>

<script type="text/javascript" src="http://cdn.bootcss.com/leaflet/1.0.3/leaflet.js"></script>
<script type="text/javascript" src="https://rawgit.com/mapshakers/leaflet-icon-pulse/master/src/L.Icon.Pulse.js"></script>
<script type="text/javascript" src="../../dist/iclient9-leaflet.min.js"></script>
<script type="text/javascript">
    var map, resultLayer, markers = [],
            dataUrl = "http://support.supermap.com.cn:8090/iserver/services/data-DynamicData/rest/data",
            url = "http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China",
            pulseIcon = L.icon.pulse({
                iconSize: [12, 12],
                color: '#2f8'
            });
    map = L.map('map', {
        preferCanvas: true,
        center: [32, 104],
        maxZoom: 18,
        zoom: 4
    });
    L.supermap.tiledMapLayer(url).addTo(map);
    loadPulse();

    function loadPulse() {
        var point1 = L.CRS.EPSG3857.project(L.latLng(22, 96));
        var point2 = L.CRS.EPSG3857.project(L.latLng(42, 124));
        var bounds = L.latLngBounds(L.latLng(point1.y, point1.x), L.latLng(point2.y, point2.x));
        var boundsParam = new SuperMap.GetFeaturesByBoundsParameters({
            datasetNames: ["DynamicData:Point"],
            bounds: bounds
        });
        L.supermap
                .featureService(dataUrl)
                .getFeaturesByBounds(boundsParam, function (serviceResult) {
                    createLayers(serviceResult.result.features);
                });
    }
    function createLayers(result) {
        if (!result || !result.features || result.features.length < 1) {
            return;
        }
        result.features.map(function (feature) {
            var latLng = L.CRS.EPSG3857.unproject(L.point(feature.geometry.coordinates));
            markers.push(L.marker(latLng, {icon: pulseIcon}));
        });
        resultLayer = L.featureGroup(markers).addTo(map);
    }
</script>
</body>
</html>